<template>
    <div>
        <h1>权益信息修改</h1>
        <table class="table">
            <thead>
                <tr>
                    <td>权益名称</td>
                    <td>
                      <input type="text" v-model="data.name">
                    </td>
                </tr>
                <tr>
                    <td>权益说明</td>
                    <td>
                        <input type="text" v-model="data.shemo">
                    </td>
                </tr>
                <tr>
                    <td>权益状态</td>
                    <td>
                        <input type="checkbox" v-model="data.start">选中为启用，不选中为禁用
                    </td>
                </tr>
                <tr>
                    
                    <td colspan="2">
                        <input type="button" value="修改" @click="Add">
                    </td>
                </tr>
            </thead>
        </table>
    </div>
</template>
<script setup lang="ts">
import {ref,onMounted}  from "vue"
import axios from "axios";
import { useRoute } from "vue-router";
const router=useRoute();
onMounted(()=>{
    Fantian();
})
const Fantian=()=>{
    var x=router.query.id
    axios.get("https://localhost:7083/api/Query/Fant",{params:{id:x}}).then(res=>{
      data.value=res.data
    })
}
const data=ref({
    "qid": 0,
  "name": "",
  "shemo": "",
  "start": true
})
const Add=()=>{
    axios.put("https://localhost:7083/api/Query/UpdQuery",data.value).then(res=>{
        if(res.data>0){
            alert('修改成功');
            location.href='/Showview';
        }
        else{
            alert('修改失败');
        }
    })
}
</script>
<style scoped></style>


